package com.cal.calonecal.common;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @author 76004
 * @apiNote
 * @date 2023/4/25 8:16
 */
@Data
@AllArgsConstructor
public class Response<T> {
    String msg;
    /***
     * 200 success
     * 400 fail
     */
    Integer code;
    T data;
    public static <T>Response<T> success(T data){
        return new Response<>("success",200,data);
    }

    public static <T>Response<T> success(){
        return new Response<T>("success",200,null);
    }

    public static <T>Response<T> error(){
        return new Response<T>("error",400,null);
    }

    public static <T>Response<T> error(String msg){
        return new Response<>(msg,400,null);
    }


}
